package vista;
import java.awt.event.ActionListener;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;




/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class vVentasporProducto extends javax.swing.JFrame {
	private JLabel lblorden;
	private JComboBox cmborden;
	private JComboBox cmbascdes;
	private JButton btnsalir;
	private JScrollPane scmodelo;
	private JLabel lbltitulo;
	private JTable tabla;
	private vVporProductoMT modelo;
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				vVentasporProducto inst = new vVentasporProducto();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public vVentasporProducto() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setBackground(new java.awt.Color(255,255,255));
			getContentPane().setLayout(null);
			{
				lblorden = new JLabel();
				getContentPane().add(lblorden);
				lblorden.setText("Ordenado :");
				lblorden.setBounds(41, 46, 75, 16);
			}
			{
				ComboBoxModel cmbordenModel = 
					new DefaultComboBoxModel(
							new String[] { "Monto", "Cantidad"});
				cmborden = new JComboBox();
				getContentPane().add(cmborden);
				cmborden.setModel(cmbordenModel);
				cmborden.setBounds(115, 43, 105, 23);
			}
			{
				ComboBoxModel cmbascdesModel = 
					new DefaultComboBoxModel(
							new String[] { "Ascendente", "Descendente" });
				cmbascdes = new JComboBox();
				getContentPane().add(cmbascdes);
				cmbascdes.setModel(cmbascdesModel);
				cmbascdes.setBounds(243, 43, 122, 23);
			}
			{
				lbltitulo = new JLabel();
				getContentPane().add(lbltitulo);
				lbltitulo.setText("Ventas por Productos");
				lbltitulo.setBounds(221, 104, 179, 16);
				lbltitulo.setFont(new java.awt.Font("Segoe UI",1,14));
			}
			{
				scmodelo = new JScrollPane();
				getContentPane().add(scmodelo);
				scmodelo.setBounds(41, 143, 496, 163);
				{
					tabla = new JTable();
					scmodelo.setViewportView(tabla);
					modelo = new vVporProductoMT();
					tabla.setModel(modelo);
				}
			}
			{
				btnsalir = new JButton();
				getContentPane().add(btnsalir);
				btnsalir.setText("Salir");
				btnsalir.setBounds(510, 353, 71, 23);
			}
			pack();
			this.setSize(623, 431);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	public void addListener(ActionListener actionListener) 
	{
		cmbascdes.addActionListener(actionListener);
		cmborden.addActionListener(actionListener);
		btnsalir.addActionListener(actionListener);
    }
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public JComboBox getascdes(){
		return cmbascdes;
	}
	public JComboBox getordenado(){
		return cmborden;
	}
	public vVporProductoMT getModelo()
	{
		return modelo;
	}
	public void setResultados(AbstractTableModel abstractTableModel) {
		tabla.setModel(abstractTableModel);
	}

}
